/**
 * Created by zjf on 2017/2/22.
 */
//shop scene
var SkillTreeLayer = cc.Layer.extend({
    bg:null,
    ctor:function (args) {
        this._super();

        this.initUI(args);


        //return btn ,and return new heroText


        //setTimeout(function () {
        //    cc.director.popScene();
        //}, 5000);
        var ReturnBtn = new ccui.Button(res.return_png);
        ReturnBtn.attr({
            x:size.width-size.width/8 ,
            y:size.height-size.height/3,

        });
        ReturnBtn.addClickEventListener(this.returnGame, this);
        this.addChild(ReturnBtn);

    },
    returnGame:function(){
        //cc.director.runScene(new GameScene());
        cc.director.popScene();
    },
    initUI:function(jsonText){
        var json = JSON.parse(jsonText);


        //this.hero = new Hero(HeroJson);
        //this.hero.mySprite.setFlippedX(true);
        //this.addChild(this.hero.mySprite);
        //this.hero.nameText = new cc.MenuItemFont("name:" + this.hero.name);
        //this.hero.nameText.x = 100;
        //this.hero.nameText.y = this.hero.mySprite.y - 100;
        //this.addChild(this.hero.nameText);
        //this.hero.hpText = new cc.MenuItemFont("hp:" + this.hero.hp+"//"+this.hero.hpMax);
        //this.hero.hpText.x = 100;
        //this.hero.hpText.y = this.hero.mySprite.y - 130;
        //this.addChild(this.hero.hpText);
        //this.hero.levelText = new cc.MenuItemFont("level:" + this.hero.level);
        //this.hero.levelText.x = 100;
        //this.hero.levelText.y = this.hero.mySprite.y - 160;
        //this.addChild(this.hero.levelText);
        //this.hero.expText = new cc.MenuItemFont("exp:" + this.hero.exp);
        //this.hero.expText.x = 100;
        //this.hero.expText.y = this.hero.mySprite.y - 190;
        //this.addChild(this.hero.expText);
    },


});

var SkillTreeScene = cc.Scene.extend({
    ctor:function (args) {
        this._super();
        this.args = args;
    },
    onEnter:function () {
        this._super();
        var layer = new SkillTreeLayer(this.args);
        this.addChild(layer);
    }
});